<!DOCTYPE html>
<html>
<head>
    <title>记录详情</title>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">


    <link rel="stylesheet" href="__STATIC__/mobile/css/weui.min.css">
    <link rel="stylesheet" href="__STATIC__/mobile/css/jquery-weui.css">
    <!-- <link rel="stylesheet" href="__STATIC__/mobile/css/style.min.css"> -->
    <link rel="stylesheet" href="__STATIC__/mobile/css/demos.css">
    <link rel="stylesheet" href="__STATIC__/mobile/css/main.css">
    <link rel="stylesheet" href="__STATIC__/mobile/css/iconfont.css">
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=DA6Bw0637vf4t96C4GRhyPBMyplqG6zA"></script>
    <style>
        .navbar {
            height: 50px;
            color: #fff;
            background: #179b16;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 99;
            display: -webkit-box;
            display: -ms-flexbox;
            overflow: hidden;
        }
        .navbar .nav-wrap-left {
            height: 100%;
            width: 25%;
            line-height: 50px;
        }
        .navbar .nav-wrap-left .nav-btn {
            padding-right: 0;
        }
        .navbar .nav-btn {
            padding: 0 0 0 10%;
            width: 90%;
            height: 100%;
            display: block;
            color: #fff;
            font-size: 14px;
        }
        a:active, a:focus, a:hover, a:visited {
            color: #bbb;
        }
        a, a:hover, del, ins, s, u {
            text-decoration: none;
        }
        .barbtn, a, button, em, input, textarea {
            -webkit-tap-highlight-color: rgba(255,0,0,0);
        }
        a {
            color: #666;
            text-decoration: none;
            outline: 0;
        }
        .navbar .nav-title {
            width: 50%;
            height: 100%;
            overflow: hidden;
            line-height: 50px;
            text-align: center;
            -webkit-box-flex: 1;
            -ms-flex: 1;
        }
        .navbar .nav-wrap-right {
            height: 100%;
            width: 25%;
            line-height: 50px;
            text-align: right;
        }
        .filterbar .dropdown-toggle.active {
            color: #179b16;
        }
        .icon-xuanzechengshi {
            font-size: 8px!important;
        }
        #joblist .list-item .salary span, #loadMore .list-item .salary span, #recommend-job .list-item .salary span {
            color: #179b16;
            font-size: .42rem;
        }
        .pic {
            width: 55px!important;
        }
        .pic img{
            width: 55px!important;
            height: 55px;
        }
        .filterbar .dropdown-wrapper {
            position: absolute;
            width: 100%;
            z-index: inherit;
        }
        .filterbar .nav {
            position: relative;
            z-index: inherit;
        }
        .block {
            display: block;
        }
        .none {
            display: none;
        }
        .filterbar .nav {
            display: -webkit-box;
            display: -ms-flexbox;
            background: #fff;
            border-bottom: 1px solid #e5e5e5;
            text-align: center;
            height: .86rem;
            line-height: .86rem;
            -webkit-user-select: none;
            font-size: 13px;
            text-align: center;
        }
        .main {
            /*padding: 0!important;*/
            padding-top: 50px;
            z-index: 9999999;
        }
        .filterbar .category-wrapper {
            overflow: scroll;
        }
        .category-wrapper {
            max-height: 480px!important;
        }
        .  .top-logo img{
            border-radius: 50%;
        }
        /*.weui-uploader__file {
            width: 40%;
            height: 79px;
        }*/
        .top-logo {
            width: 100%;
            height: 8em;
            margin-top: 1em;
            overflow: hidden;
        }
        .top-logo img {
            width: 6em;
            height: 6em;
            margin: 1em auto;
            display: block;
        }
        .weui-cell2:after {
            content: " ";
            position: absolute;
            left: 0;
            right: 0;
            height: 1px;
            color: #d9d9d9;
            bottom: 0;
            border-bottom: 1px solid #d9d9d9;
            -webkit-transform-origin: 0 100%;
            transform-origin: 0 100%;
            -webkit-transform: scaleY(.5);
            transform: scaleY(.5);
        }
        /*.weui-uploader__file {
              float: left;
              background: no-repeat 50%;
              background-size: cover;
              display: inline-block;
              margin: 0px 5%;
              background-size: 100% 100%;
          }*/
        .weui-cells {
            margin-top: 0.2em;
        }
        .pic {
            width: 55px!important;
        }
        .pic img{
            width: 55px!important;
            height: 55px;
        }
        .filterbar .dropdown-wrapper {
            position: absolute;
            width: 100%;
            z-index: inherit;
        }
        .filterbar .nav {
            position: relative;
            z-index: inherit;
        }
        .block {
            display: block;
        }
        .none {
            display: none;
        }
        .bottombar #send span {
            background: #ff9433;
        }
        .main {
            width: 100%;
            padding: 50px 0;
        }
        .content {
            padding: 5px .1rem;
        }
        .detail-top {
            width: 100%;
            height: 70px;
            background: #fff;
            border-radius: 3px;
        }
        .detail-top-left {
            width: auto;
            height: 100%;
            overflow: hidden;
            float: left;
        }
        .detail-top-left img{
            width: 55px;
            height: 55px;
            margin: 7.5px;
        }
        .detail-top-mid {
            width: 60%;
            height: 100%;
            overflow: hidden;
            float: left;
            margin-left: 5px;
        }
        .detail-title {
            width: 100%;
            height: 40px;
            line-height: 32px;
            font-size: 14px;
            padding-top: 5px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .detail-type {
            width: 46px;
            height: 20px;
            text-align: center;
            line-height: 20px;
            color: #fff;
            background: #ff9433;
            float: left;
            font-size: 10px;
            border-radius: 3px;
        }
        .detail-top-right {
            width: 15%;
            height: 100%;
            overflow: hidden;
            float: right;
        }
        .detail-money {
            width: auto;
            height: 40px;
            text-align: center;
            font-size: 20px;
            line-height: 50px;
        }
        .detail-mtype {
            text-align: center;
        }
        .detail-content{
            width: 100%;
            height: auto;
            overflow: hidden;
            background: #fff;
            margin-top: 5px;
        }
        .each-introduce {
            width: 100%;
            height: auto;
            background: #fff;
            overflow: hidden;
        }
        .introduce-left {
            width: auto;
            height: auto;
            overflow: hidden;
            float: left;
            text-align: center;
            line-height: 3em;
        }
        .introduce-right {
            width: 70%;
            height: auto;
            overflow: hidden;
            float: left;
            text-align: left;
            line-height: 1.5em;
            padding-top: 9px;
        }
        .introduce-new {
            background: #fff;
            width: 94%;
            height: auto;
            overflow: hidden;
            float: right;
            text-align: left;
            line-height: 1.5em;
            padding: 0 2% 0 4%;
            margin-bottom: 5px;
        }
    </style>
</head>

<body ontouchstart style="background: #fff">

<div class="navbar">
    <div class="nav-wrap-left">
        <a class="nav-btn" href="javascript:history.go(-1);">
            <i style="font-size: 22px" class="iconfont icon-goback"></i>
        </a>
    </div>
    <div class="nav-title">记录详情</div>
    <div class="nav-wrap-right">
        <!-- <a class="nav-btn" href="javascript:exit();">
            <i style="font-size: 18px;margin-right: 10%;" class="iconfont  loginType" data-type=""></i>
            +新增
        </a> -->
    </div>
</div>
<!-- 正文 -->
<div class="main">
    <div class="weui-cells weui-cells_form">
        <div class="weui-cell">
            <if condition="$info['o_type'] eq 1">
                <div class="weui-cell__hd">
                    <label class="weui-label">
                        派发
                    </label>
                </div>
                <input id="user_follownum" class="weui-input" type="text" placeholder="派发礼品数量" value="{$info['num']}" disabled="disabled">
            </if>
            <if condition="$info['o_type'] eq 3">
                <div class="weui-cell__hd">
                    <label class="weui-label">
                        关注
                    </label>
                </div>
                <div class="weui-cell__bd">
                    <input id="user_follownum" class="weui-input" type="text" placeholder="关注数量" value="{$info['num']}" disabled="disabled">
                </div>
            </if>
            <if condition="$info['o_type'] eq 2">
                <div class="weui-cell__hd">
                    <label class="weui-label">
                        购买
                    </label>
                </div>
                <div class="weui-cell__bd">
                    <input id="user_follownum" class="weui-input" type="text" placeholder="购买数量" value="{$info['num']}" disabled="disabled">
                </div>
            </if>
        </div>
    </div>
    <div class="weui-cells weui-cells_form">
        <div class="weui-cell">
            <div class=""><label class="" >上传凭证</label></div>
                <div class="weui-uploader__bd" style="padding: 10px;width: 100%;box-sizing: border-box;">
                    <ul class="weui-uploader__files" id="uploaderFiles1" >
                <foreach name="img" item="vo">
                            <li class="weui-uploader__file" data="{$vo}" style="background-image:url({$vo|img_src=$vo}"></li>
                </foreach>
                    </ul>
                <!--
                   <div class="weui-uploader__input-box">
						<span id="uploaderInput1" class="weui-uploader__input" onclick="chooseImage(this,'edit')">
                    </div>
                -->
                </div>

        </div>
     
            <div class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">客户姓名</label></div>
                <div class="weui-cell__bd">
                    <input id="user_name" class="weui-input" type="text" placeholder="客户姓名" value="{$info['u_name']}" disabled="disabled">
                </div>
            </div>
            <div class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">客户手机号</label></div>
                <div class="weui-cell__bd">
                    <input id="user_phone" class="weui-input" type="text" placeholder="客户手机号" value="{$info['u_mobile']}" disabled="disabled">
                </div>
            </div>
   

    </div>
    <div class="weui-cells weui-cells_form">
        <!-- <div style="text-align: center;padding: 5px 0;background: #ffd966;color: #000;font-family: "黑体";">绩效数据</div> 
        <div class="content">

            <div class="weui-btn-area">

                <div class="weui-cell">
                        <div class="weui-cell__bd" >
                            <button type="submit" class="weui-btn weui-btn_primary" onclick='edit_record( )' >修改</button>
                        </div>
                        </div>
                </div>
            </div>
            -->
    </div>
</div>
<div id="allmap1"></div>
<script src="__STATIC__/mobile/js/jquery-2.1.4.js"></script>
<!-- <script src="js/fastclick.js"></script> -->
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>
    $(function() {
        console.log(window.localStorage.mid);
        checkLogin();
        wx.config({
            debug: false,
            appId: '{$sign.appId}',
            timestamp: '{$sign.timestamp}',
            nonceStr:'{$sign.nonceStr}',
            signature: '{$sign.signature}',
            jsApiList: [
                'chooseImage','uploadImage'
            ]
        });
        $.hideLoading();

    });
</script>
<script src="__STATIC__/mobile/js/jquery-weui.js"></script>
<script src="__STATIC__/mobile/js/city-picker.js"></script>
<script src="__STATIC__/mobile/js/globalvariable.js"></script>
<script src="__STATIC__/mobile/js/sose.js"></script>
<script>
    // $("#showTooltips").click(function() {

    // })
    // 下拉刷新
    // $('#joblist').pullToRefresh();
    //   $('.main').pullToRefresh().on("pull-to-refresh", function() {
    //    setTimeout(function() {
    //    	alert("下拉刷新");
    //    	$('.main').pullToRefreshDone();
    //    }, 1000);
    // });
    // 上拉加载
    // $('#joblist').infinite();
    var loading = false;
    var areaName = '';
    var cityName = '';
    var pageNo = 1;
    var pageSize = 10;
    var flag ='asc';
    var jobType = 0;
    var workType = 0;
    var tid;
    var jobTypeName;
    var city = window.localStorage.city;
    var latitude;
    var longitude;
    var first = true;
    function checkLogin() {
        // alert(window.localStorage.mid);
        if (isNull(window.localStorage.mid)) {
            $('.loginType').attr("data-type",2);
            $('.loginType').removeClass("icon-tuichudenglu").addClass("icon-iconfontwodea-copy-copy");
        } else {
            var obj = {
                'mId':window.localStorage.mid,
            };
            doPost("account/info.web", obj, function(data) {
                // JSON.stringify(data)
                // alert(JSON.stringify(data));
                if (data.success) {
                    // alert(1);
                    $('.loginType').attr("data-type",1);
                    $('.loginType').addClass("icon-tuichudenglu").removeClass("icon-iconfontwodea-copy-copy");
                } else {
                    // alert(2);
                    $('.loginType').attr("data-type",2);
                    $('.loginType').removeClass("icon-tuichudenglu").addClass("icon-iconfontwodea-copy-copy");
                    $.toast(data.errMsg,"text");
                }
            }, function(data) {
                $.toast(data.errMsg,"text");
            });
        }

    }
    $(window).scroll(function(){
        var scrollh = $(document).height();
        var bheight =  $(window).height();
        console.log("scrollh:"+scrollh+",bheight:"+bheight);
        var scrollTop=Math.max(document.documentElement.scrollTop||document.body.scrollTop);
        if((scrollTop + $(window).height()) >= scrollh){
            // alert("jiazai");
        }
    });
    function chooseImage(obj,r_id){
        // 选择张片
        wx.chooseImage({
            count: 1, // 默认9
            sizeType: [ 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
            sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
            success: function(res) {
                var localIds = res.localIds;
                //alert(localIds)
                // 返回选定照片的本地ID列表，localId可以作为img标签的src属性显示图片
                // 上传照片
                uploadImg(localIds,r_id)
            }
        });
    }
    wx.config({
        debug: false,
        appId: '{$sign.appId}',
        timestamp: '{$sign.timestamp}',
        nonceStr:'{$sign.nonceStr}',
        signature:'{$sign.signature}',
        jsApiList: [
            'chooseImage','uploadImage'
        ]
    });
    function uploadImg(localIds,r_id){
        var localId = localIds.pop();
        wx.uploadImage({
            localId: localId,
            isShowProgressTips: 1,
            success: function(res) {
                serverId =res.serverId;
                $.ajax({
                    url:"{:U('My/get_img')}",
                    type:"POST",
                    dataType:"json",
                    data:{img_id:serverId,id:"<?php echo $_GET['a_id'];?>",r_id:r_id},
                    success:function(ret){
                        //返回图片在服务器地址ret.save_path
                        var imgSrc = ret.save_path
                        if(ret.ret==1){
                            var ul = $(".weui-uploader__bd").find("ul");

                            //添加 li
                            var li = document.createElement("li");

                            //设置 li 属性，如 id
                            li.setAttribute("class", "weui-uploader__file");
                            li.setAttribute("data", imgSrc);
                            li.setAttribute("style", "background-image:url("+"http://house.wechatpic.com/upload/weixin/"+imgSrc+")");
                            ul.append(li);
                            alert("上传成功");
                        }
                        if(localIds.length > 0){
                            uploadImg(localIds,r_id);
                        }
                    },
                    error : function(x,y,z){
                        console.log(x);
                        console.log(y);
                        console.log(z);
                    }
                })
            }
        });


    }
    function edit_record() {
        var img = [];
        $("li").each(function(i){
            img[i]=($(this).attr("data"))
        });
        $.ajax({
            url:"{:U('edit_record')}",
            data:{
                r_id:"<?php echo $_GET['r_id'];?>",
                a_id:"<?php echo $_GET['a_id'];?>",
                num:$("#user_follownum").val(),
                u_name:$("#user_name").val(),
                u_mobile:$("#user_phone").val(),
                img:img
            },
            dataType:"json",
            type:"POST",
            success:function(ret){
                if(ret.ret==1){
                    alert(ret.msg);
                }
            }
        })
    }
</script>
</body>
</html>
